package com.shop.service.impl;

import com.shop.entity.Result;
import com.shop.mapper.CategoryMapper;
import com.shop.pojo.Category;
import com.shop.pojo.CategoryExample;
import com.shop.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl implements CategoryService {


    @Autowired
    private CategoryMapper categoryMapper;

    /** 1.查询所有分类 */
    @Override
    public List<Category> findAll() {
        CategoryExample ce = new CategoryExample();
        ce.createCriteria().andCidIsNotNull();
        List<Category> categories = categoryMapper.selectByExample(ce);
        return categories;
    }

    @Override
    /** 2.添加新的分类 */
    public Result addCategory(Category category) {
        return null;
    }

    @Override
    /** 3.删除分类 */
    public Result deleteCategory(String cid) {
        return null;
    }
}
